function enable_or_disable_velocity_overlay ( hObject, arg )
% ENABLE_OR_DISABLE_VELOCITY_OVERLAY:
%
% There are situations where the user should not have the option of
% even trying to create a velocity overlay.
%
%     1.  There is no "u" or "v" dataset in the netcdf file.  We need
%         to actually check the netcdf file in this case.
%



handles = guihandles ( hObject );

%
% If the 2nd argument is numeric and zero, then just disable it now.
if isnumeric ( arg )
	if arg == 0
		set ( handles.velocity_overlay_tag, 'Enable', 'off' );
		set ( handles.vslice_velocity_menu, 'Enable', 'off' );
		return
	end
else
	ncfile = arg;
end



have_u = 0;
have_v = 0;

%
% Check for both U and V
if nc_isvar ( ncfile, 'u' )
	have_u = 1;
end
if nc_isvar ( ncfile, 'u' )
	have_v = 1;
end


if have_u & have_v 
	set ( handles.velocity_overlay_tag, 'Enable', 'on' );
else
	set ( handles.velocity_overlay_tag, 'Enable', 'off' );
end
